package com.sojson.project.dao.impl;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.sojson.base.impl.BaseDaoImpl;
import com.sojson.project.dao.OrderGoodsDao;
import com.sojson.project.entity.po.OrderGoods;

/**
 * Dao实现类(目的:把分页插件从Service层分离,这样就不用每次调Dao接口都要分页)
 * 
 * @author liu
 * @date 2021-03-16
 */
@Repository
public class OrderGoodsDaoImpl extends BaseDaoImpl<OrderGoodsDao, OrderGoods> implements OrderGoodsDao {

    @Resource
    private OrderGoodsDao orderGoodsDao;

    /**
     * 单条插入
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int insert(OrderGoods orderGoods) {
        return orderGoodsDao.insert(orderGoods);
    }

    /**
     * 批量插入
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int insertList(List<OrderGoods> orderGoodss) {
        return orderGoodsDao.insertList(orderGoodss);
    }

    /**
     * 通过对象批量删除(物理删除)
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByDto(OrderGoods orderGoods) {
        return orderGoodsDao.deleteByDto(orderGoods);
    }

    /**
     * 统计全部数量
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public int countAll() {
        return orderGoodsDao.countAll();
    }

    /**
     * 查询所有
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public List<OrderGoods> listAll() {
        return orderGoodsDao.listAll();
    }

    /**
     * 根据对象统计数量
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int countByDto(OrderGoods orderGoods) {
        return orderGoodsDao.countByDto(orderGoods);
    }

    /**
     * 根据对象查询
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public List<OrderGoods> listByDto(OrderGoods orderGoods) {
        startPage(orderGoods);
        return orderGoodsDao.listByDto(orderGoods);
    }

    /**
     * 通过id删除(物理删除)
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteById(Integer id) {
        return orderGoodsDao.deleteById(id);
    }

    /**
     * 通过id列表删除(物理删除)
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByIdList(List<Integer> ids) {
        return orderGoodsDao.deleteByIdList(ids);
    }

    /**
     * 通过id更新(全部更新)
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int updateById(OrderGoods orderGoods) {
        return orderGoodsDao.updateById(orderGoods);
    }

    /**
     * 通过id列表更新(全部更新)(更新内容相同)
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticByIdList(OrderGoods orderGoods) {
        return orderGoodsDao.updateStaticByIdList(orderGoods);
    }

    /**
     * 通过id列表更新(全部更新)(更新内容不相同)
     * 
     * @param orderGoodss
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangeByIdList(List<OrderGoods> orderGoodss) {
        return orderGoodsDao.updateChangeByIdList(orderGoodss);
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int updatePartialById(OrderGoods orderGoods) {
        return orderGoodsDao.updatePartialById(orderGoods);
    }

    /**
     * 通过id列表更新(局部更新)(更新内容相同)
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticPartialByIdList(OrderGoods orderGoods) {
        return orderGoodsDao.updateStaticPartialByIdList(orderGoods);
    }

    /**
     * 通过id列表更新(局部更新)(更新内容不相同)
     * 
     * @param orderGoodss
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangePartialByIdList(List<OrderGoods> orderGoodss) {
        return orderGoodsDao.updateChangePartialByIdList(orderGoodss);
    }

    /**
     * 通过id查询
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public OrderGoods findById(Integer id) {
        return orderGoodsDao.findById(id);
    }

    /**
     * 通过id列表查询
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public List<OrderGoods> findByIdList(List<Integer> ids) {
        return orderGoodsDao.findByIdList(ids);
    }

    /**
     * 通过对象查询id列表
     * 
     * @param orderGoods
     * @return
     * @throws SQLException
     */
    @Override
    public List<Integer> findIdByDto(OrderGoods orderGoods) {
        return orderGoodsDao.findIdByDto(orderGoods);
    }

    /**
     * 清空数据(物理清空)
     * 
     * @throws SQLException
     */
    @Override
    public void clear() {
        orderGoodsDao.clear();
    }

    /**
     * 通过订单编号删除(物理删除)
     * 
     * @param orderNo
     * @return
     */
    @Override
    public int deleteByOrderNo(String orderNo) {
        return orderGoodsDao.deleteByOrderNo(orderNo);
    }

    /**
     * 通过订单编号查询
     * 
     * @param orderNo
     * @return
     */
    @Override
    public OrderGoods findByOrderNo(String orderNo) {
        return orderGoodsDao.findByOrderNo(orderNo);
    }

    /**
     * 统计订单商品数量
     * 
     * @param orderNo
     * @return
     */
    @Override
    public int countNumByOrderNo(String orderNo) {
        return orderGoodsDao.countNumByOrderNo(orderNo);
    }

}